<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:birt="http://jsf4birt.components"
	template="/templates/template.xhtml">
    

<ui:define name="body">

    <h:form id="budgetReport" >
    
    	<h:outputText value="#{budgetReportController.loadDefaultValues()}"/>
       
		<div align="center">
			<rich:panel style="background: transparent">
				<h:panelGrid columns="4" width="100%">
					<h:outputText value="#{msg['general.year']}" />
					
					<h:inputText value="#{budgetReportController.anio}" size="5"/>
					
					<h:outputText value="#{msg['general.month']}" />
					
					<h:selectOneMenu id="cmbMes"
						value="#{budgetReportController.mes}"
						styleClass="cmbForm">
						<f:selectItem itemLabel="--seleccione--" itemValue="00" />
						<f:selectItem itemLabel="Enero" itemValue="01" />
						<f:selectItem itemLabel="Febrero" itemValue="02" />
						<f:selectItem itemLabel="Marzo" itemValue="03" />
						<f:selectItem itemLabel="Abril" itemValue="04" />
						<f:selectItem itemLabel="Mayo" itemValue="05" />
						<f:selectItem itemLabel="Junio" itemValue="06" />
						<f:selectItem itemLabel="Julio" itemValue="07" />
						<f:selectItem itemLabel="Agosto" itemValue="08" />
						<f:selectItem itemLabel="Septiembre" itemValue="09" />
						<f:selectItem itemLabel="Octubre" itemValue="10" />
						<f:selectItem itemLabel="Noviembre" itemValue="11" />
						<f:selectItem itemLabel="Diciembre" itemValue="12" />
					</h:selectOneMenu>
				</h:panelGrid>
			</rich:panel>
		</div>

			
		<rich:modalPanel id="pnlModalProcess" autosized="true" minWidth="200">
	   		<center>
	      		<p>#{msg['general.processing']}</p>
			</center>
	    </rich:modalPanel>
	    
		<rich:spacer height="20"/>
        
        <a:outputPanel id="messagesPanel"> 
        	<div align="center">
				<a:outputPanel style="align:left" rendered="#{not empty budgetReportController.messageError}">
			   		<h:graphicImage value="/images/error.gif" rendered="#{not empty budgetReportController.messageError}" styleClass="errors" />
					<h:outputLabel value="#{budgetReportController.messageError}" rendered="#{not empty budgetReportController.messageError}" styleClass="errors"/>
					<rich:spacer height="20" rendered="#{not empty budgetReportController.messageError}"/>
				</a:outputPanel>
			</div>
		</a:outputPanel>
		
		
		<a:outputPanel id="reportFilePanel"> 
        	<div align="center">
				<a:outputPanel style="align:left" rendered="#{empty budgetReportController.messageError and
					not empty budgetReportController.fileName}">
					
					<h:commandLink action="#{budgetReportController.downloadFile}">
						<h:graphicImage value="/images/excel_ico.jpg" style="align:center" />
					</h:commandLink>
					
				</a:outputPanel>
			</div>
		</a:outputPanel>
						
		<rich:spacer height="20"/>
		
        <div align="center">
        	<a:outputPanel id="buttonsDataLoad">					
				<a:commandButton 
					action="#{budgetReportController.validate}"
					oncomplete="if(#{budgetReportController.validForm}) Richfaces.showModalPanel('processPanel');" 
					value="#{msg['general.processReport']}" 
					reRender="messagesPanel"/>
			</a:outputPanel>
		</div>
		
		
	    <rich:modalPanel  id="processPanel" minHeight="150" minWidth="400" 
	            height="150" width="400">
	            <f:facet name="header">
	                <h:outputText value="#{messages['general.message.confirm']}" />
	            </f:facet>
	            
	            <f:facet name="controls">
			         <h:panelGroup>
			         	<h:graphicImage value="/images/close1.png" styleClass="hidelink" id="processPanelLink"/>
			            <rich:componentControl for="processPanel" attachTo="processPanelLink" operation="hide" event="onclick"/>
			         </h:panelGroup>
			    </f:facet>
	                
	            <p>#{msg['budgetReport.confirm.process']}</p> 
	                
				<div align="center">
				
					<a:commandButton value="#{msg['general.accept']}" 
		            				   action="#{budgetReportController.buildBudgetReport}"
		            				   immediate="false"
		            				   bypassUpdates="true"
		            				   onclick="#{rich:component('processPanel')}.hide(); Richfaces.showModalPanel('pnlModalProcess');"
									   oncomplete="Richfaces.hideModalPanel('pnlModalProcess');"
									   reRender="messagesPanel,reportFilePanel">
		            </a:commandButton>
		            
		            <a:commandButton value="#{msg['general.cancel']}"
									   onclick="#{rich:component('processPanel')}.hide()">    
		            </a:commandButton>
		            
				</div>
	    </rich:modalPanel>
			
</h:form>

</ui:define>

</ui:composition>